<?php
declare(strict_types=1);
namespace Service\CommodityService;

use App\Model\BaseModel\BaseCommodityModel;
use Service\ConsumerService\ConsumerMapping\CommodityChangeMapping;
use Service\ConsumerService\ConsumerMapping\CommodityMapping;

class SupplierCommodityValidateService extends BaseCommodityModel
{
    /**
     * 判断新旧商品是否有变化
     * @param $communityMappings
     * @return bool
     */
    public function checkCommodityArchivesChange($communityMappings): bool
    {
        return CommodityChangeMapping::instance()->checkCommodityArchivesChange($communityMappings);
    }

    /**
     * 判断新旧商品是否有变化
     * @param $communityMappings
     * @param string $type
     * @return bool
     */
    public function checkCommodityUpdateChange($communityMappings,$type='supplier_pull_message'): bool
    {
        return CommodityChangeMapping::instance()->checkCommodityUpdateChange($communityMappings,config('consumer_validate.'.$type));
    }

    /**
     * 判断新旧商品是否有变化
     * @param $stockInfoMappings
     * @param $supplier
     * @return bool
     */
    public function checkStockInfoUpdateChange($stockInfoMappings,$supplier): bool
    {
        return CommodityChangeMapping::instance()->checkStockInfoUpdateChange($stockInfoMappings,$supplier);
    }


}